//+------------------------------------------------------------------+
//|                                                  patternTest.mq4 |
//|                                         Dimitri Rudel 28.10.2013 |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Dimitri Rudel 28.10.2013"
#property link      ""
#include <basic3.mqh>
#include <pattern.mqh>
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+

datetime oldTime;
int start()
  {
  
        if(oldTime == Time[0]){
         return(0);   
         }    
         oldTime = Time[0];
         int cmd;
         double price;
         double sl = price;
         double tp = price;
         int signal = p_getSignal();
         if(signal == -1){
              drawV(oldTime,"signal "+signal);
              price = Ask;
              cmd = 0;
              sl = price - (Point *50);
              tp = price + (Point *50);
         }else if(signal == 1){
              drawV(oldTime,"signal "+signal);
              price = Bid;
              cmd = 1;
              sl = price + (Point *50);
              tp = price - (Point *50);
         }else{
            return (0);
         }
         
         b_OrderSend(Symbol(),cmd,0.1,price,3,sl,tp); 
//----
   
//----
   return(0);
  }
  
  
  
  void drawV(datetime dt,string name = "line",color col = Black){ 
   if(!exDebug){
      return (0);
   } 
   
   ObjectCreate(name,OBJ_VLINE,0,dt,0);
   ObjectSet(name,OBJPROP_STYLE,STYLE_DOT);  
   ObjectSet(name,OBJPROP_COLOR,col);
}